from flask import Flask, request
from flask import render_template
from reserch import reserch4letters

app = Flask(__name__)

@app.route('/',methods=['GET','POST'])
def hello_world():
    return render_template('hello.html')

@app.route('/index',methods=['GET'])
def index():
    return render_template('index.html')


@app.route('/indexaeiou',methods=['POST','GET'])
def indexaeiou():
    return render_template('indexaeiou.html')

@app.route('/课程表',methods=['POST','GET'])
def 课程表():
    return render_template('课程表.html')



@app.route('/result',methods=['POST','GET'])
def result():
    py_firstname = request.form.get('firstName')
    py_lastname = request.form.get('lastName')
    py_fullname = py_firstname+' '+py_lastname
    return render_template("result.html",fullname = py_fullname)

@app.route('/resultaeiou',methods=['POST','GET'])
def resultaeiou():
    yuanyin = ['a','e','i','o','u']
    strforsearch = request.form.get('searchstr')
    py_found = {}
    for i in strforsearch:
        if i in yuanyin:
            py_found.setdefault(i, 0)
            py_found[i] += 1
    return render_template('resultaeiou.html',answer = py_found)






if __name__ == '__main__':
    app.run(host='127.0.0.1',port=5000,debug=True)
